package com.yyjj.hangqing.adapter;

import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yyjj.hangqing.R;
import com.yyjj.hangqing.entity.ZdEntity;

import tech.com.commoncore.manager.GlideManager;

public class ZdfAdpter extends BaseQuickAdapter<ZdEntity, BaseViewHolder> {

    public ZdfAdpter() {
        super(R.layout.hq_item_zdf);
    }

    @Override
    protected void convert(BaseViewHolder helper, ZdEntity item) {
        GlideManager.loadImg(item.getCoin_img_base(), (ImageView) helper.getView(R.id.img));
        helper.setText(R.id.name_tv, item.getCoin_name_base());
        helper.setText(R.id.zdf_tv, item.getCoin_gains_base() + "%");
        if (item.getCoin_gains_base().contains("-")) {
            ((TextView) helper.getView(R.id.zdf_tv)).setTextColor(mContext.getResources().getColor(R.color.green));
        } else {
            ((TextView) helper.getView(R.id.zdf_tv)).setTextColor(mContext.getResources().getColor(R.color.red));
        }
    }
}
